// 创建一个矩形的物理体并自定义物理属性
let rectangleBody = SKPhysicsBody(rectangleOf: CGSize(width: 100, height: 100))
rectangleBody.friction = 0.3 // 设置摩擦力
rectangleBody.restitution = 0.7 // 设定弹性
rectangleBody.mass = 2.5     // 定义质量

// 关联到具体的精灵上
let block = SKSpriteNode(color: .green, size: CGSize(width: 100, height: 100))
block.physicsBody = rectangleBody